//
//  PayForDepositViewController.m
//  UcarTest
//
//  Created by 陈曦 on 16/3/22.
//  Copyright © 2016年 chenxi. All rights reserved.
//

#import "PayForDepositViewController.h"
#import "Define.h"
#import "DIYCarDetailButton.h"
#import "CarDetailForgeViewController.h"
#import "BankCardPayDepositViewController.h"    
#import "BalancePayDepositViewController.h"
#import "AFNetworking.h"
#import "NetRequestGroup.h"
#import "Access_token.h"
#import "MBProgressHUD.h"

@interface PayForDepositViewController ()

@property (nonatomic, strong) UIScrollView *backgroundScrollView;

@property (nonatomic, strong) DIYCarDetailButton *carDetailBtn;

@end

@implementation PayForDepositViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //导航条
    self.navigationController.navigationBarHidden = NO;
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.font = [UIFont boldSystemFontOfSize:18];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.text = @"支付押金";
    self.navigationItem.titleView = titleLabel;
    self.navigationController.navigationBar.barTintColor = mainColor;
    self.view.backgroundColor = [UIColor whiteColor];
    
    //重定义返回键
    UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];
    back.frame = CGRectMake(0, 0, 22, 22);
    [back setImage:[UIImage imageNamed:@"iconfont-fanhui-white"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(BackAtTheNextHigherLevel) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backBar = [[UIBarButtonItem alloc] initWithCustomView:back];
    self.navigationItem.leftBarButtonItem = backBar;
    
    //背景视图
    self.backgroundScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - 48)];
    self.backgroundScrollView.backgroundColor = backgroundMainColor;
    [self.view addSubview:self.backgroundScrollView];
    self.backgroundScrollView.contentSize = CGSizeMake(kScreenWidth, kScreenHeight * 1.1);
    [self.view addSubview:self.backgroundScrollView];
    
    //确认支付按钮
    UIButton *confirmationOrderBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    confirmationOrderBtn.frame = CGRectMake(20, kScreenHeight - 41, kScreenWidth - 40, 34);
    confirmationOrderBtn.layer.cornerRadius = 3;
    confirmationOrderBtn.layer.masksToBounds = YES;
    confirmationOrderBtn.backgroundColor = mainColor;
    [confirmationOrderBtn setTitle:@"确认支付" forState:UIControlStateNormal];
    
    confirmationOrderBtn.titleLabel.tintColor = [UIColor whiteColor];
    [confirmationOrderBtn addTarget:self action:@selector(confirmationOrderPush) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:confirmationOrderBtn];
    
    [self NetworkRequests];
    
 }


#pragma mark 网络请求
- (void) NetworkRequests{
    
    //初始化进度框，置于当前的View当中
    MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.view];
    [self.view addSubview:HUD];
    HUD.label.text = @"正在加载";
    [HUD showAnimated:YES];//HUD开始
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    //申明返回的结果是json类型
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    //申明请求的数据是json类型
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    //如果报接受类型不一致请替换一致text/html或别的
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    Access_token *useAccess = [Access_token shareInstance];
    
    //传入的参数
    NSDictionary *para = @{
                           @"type" : @"1",
                           @"access_token" : useAccess.access_token,
                           @"id" : self.orderID,
                           @"order_type" : @"0"
                           };
    //你的接口地址
    NSString *url = [NSString stringWithFormat:@"%@%@", kRealmName,kNetCarOrderDetailView];
    //发送请求
    [manager POST:url parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        [HUD hideAnimated:YES];
        
        NSDictionary *dic = responseObject;
        
        self.status = dic[@"status"];
        
        self.msg = dic[@"msg"];
        
        NSDictionary *info = dic[@"info"];
        
        //共享订单号
        self.order_sn = info[@"order_sn"];
        
        //押金金额
        self.car_pledge_money = info[@"car_pledge_money"];
        
        //车辆id
        self.car_id = info[@"car_id"];
        
        //车牌
        self.car_place = info[@"car_place"];
        
        //品牌
        self.car_brand = info[@"car_brand"];
        
        //型号
        self.car_model = info[@"car_model"];
        
        //变速箱类型
        self.car_speed_box = info[@"car_speed_box"];
        
        //取车时间
        self.open_time = info[@"open_time"];
        
        //还车时间
        self.end_time = info[@"end_time"];
        
        //用车时间
        self.use_time = info[@"use_time"];
        
        //取还车地址
        self.car_address = info[@"car_address"];
        
        //订单总状态:0,待支付租金;1,待车主审核;2,待支付押金;3,用车;4,已完成;5,取消订单
        self.order_status = info[@"order_status"];
        
        //租金总额和保险总额的总和
        self.total_money = info[@"total_money"];
        
        //是否设置支付密码
        self.is_pay_password = info[@"is_pay_password"];
        
        //余额
        self.surplus_money = info[@"surplus_money"];
        
        //是否可以余额支付租金:0,不可以;1,可以
        self.is_surplus_rent = info[@"is_surplus_rent"];
        
        //是否可以支付押金
        self.is_pledge = info[@"is_pledge"];
        
        self.is_shortcut_pay = info[@"is_shortcut_pay"];;//是否可以快捷支付

        
        //=========添加布局=================
        
        //支付金额视图
        [self paymentAmountView];
        
        //车辆详情
        [self carDetailsView];

        
        //订单信息
        [self orderDetailsView];
        
        //
        [self payMethod];
        
        //返回值分析
        [self resultAnalysis];

    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        [HUD hideAnimated:YES];
        
        //初始化提示框；
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"没有网络" preferredStyle:  UIAlertControllerStyleAlert];
        
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件；
        }]];
        
        //弹出提示框；
        [self presentViewController:alert animated:true completion:nil];
        
    }];
    
}

#pragma mark  支付金额视图
- (void) paymentAmountView {
    
    //第一部分 押金
    UIView *paymentAmountBGView = [[UIView alloc] initWithFrame:CGRectMake(5, 15, kScreenWidth - 10, 40)];
    paymentAmountBGView.layer.cornerRadius = 2;
    paymentAmountBGView.layer.shadowOpacity = 1.0;
    paymentAmountBGView.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    paymentAmountBGView.layer.shadowColor = [UIColor colorWithRed:215 / 255.0 green:215 / 255.0 blue:215 / 255.0 alpha:1].CGColor;
    paymentAmountBGView.layer.shadowRadius = 1;
    paymentAmountBGView.backgroundColor = [UIColor whiteColor];
    [self.backgroundScrollView addSubview:paymentAmountBGView];
    
    UIImageView *payImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 19, 20)];
    payImageView.image = [UIImage imageNamed:@"icon-yajin"];
    [paymentAmountBGView addSubview:payImageView];
    
    UILabel *payMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 10, 80, 20)];
    payMoneyLabel.text = @"车辆押金";
    payMoneyLabel.textAlignment = NSTextAlignmentLeft;
    payMoneyLabel.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    payMoneyLabel.font = [UIFont systemFontOfSize:14];
    [paymentAmountBGView addSubview:payMoneyLabel];
    
    UILabel *unitsLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth - 32, 16, 12, 12)];
    unitsLabel.text = @"元";
    unitsLabel.textAlignment = NSTextAlignmentCenter;
    unitsLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    unitsLabel.font = [UIFont systemFontOfSize:12];
    [paymentAmountBGView addSubview:unitsLabel];
    
    //金额显示
    UILabel *unitsShowLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth - 102, 15, 82, 12)];
    unitsShowLabel.text = self.car_pledge_money;
    unitsShowLabel.textAlignment = NSTextAlignmentCenter;
    unitsShowLabel.textColor = mainColor;
    unitsShowLabel.font = [UIFont systemFontOfSize:15];
    [paymentAmountBGView addSubview:unitsShowLabel];
    
}

#pragma mark 车辆信息
//车辆信息
- (void) carDetailsView{
    
    //第一部分 车辆信息
    UIView *carDetails = [[UIView alloc] initWithFrame:CGRectMake(5, 75, kScreenWidth - 10, 70)];
    carDetails.layer.cornerRadius = 2;
    carDetails.layer.shadowOpacity = 1.0;
    carDetails.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    carDetails.layer.shadowColor = [UIColor colorWithRed:215 / 255.0 green:215 / 255.0 blue:215 / 255.0 alpha:1].CGColor;
    carDetails.layer.shadowRadius = 1;
    carDetails.backgroundColor = [UIColor whiteColor];
    [self.backgroundScrollView addSubview:carDetails];
    
    //车辆信息跳转按钮
    self.carDetailBtn = [DIYCarDetailButton buttonWithType:UIButtonTypeCustom];
    self.carDetailBtn.frame = CGRectMake(0, 0, kScreenWidth - 10, 35);
    self.carDetailBtn.layer.cornerRadius = 2;
    self.carDetailBtn.layer.masksToBounds = YES;
    [self.carDetailBtn addTarget:self action:@selector(carDetailBtnPush) forControlEvents:UIControlEventTouchUpInside];
    [carDetails addSubview:self.carDetailBtn];
    
    //车品牌
    self.carNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 35, 25, 35)];
    self.carNameLabel.textAlignment = NSTextAlignmentCenter;
    self.carNameLabel.font = [UIFont systemFontOfSize:12];
    self.carNameLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    self.carNameLabel.text = self.car_brand;
    [carDetails addSubview:self.carNameLabel];
    
    //牌照
    self.licensePlateLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 35, 80, 35)];
    self.licensePlateLabel.textAlignment = NSTextAlignmentCenter;
    self.licensePlateLabel.font = [UIFont systemFontOfSize:12];
    self.licensePlateLabel.textColor = mainColor;
    self.licensePlateLabel.text = self.car_place;
    [carDetails addSubview:self.licensePlateLabel];
    
    //型号
    self.modelLabel = [[UILabel alloc] initWithFrame:CGRectMake(145, 45, 40, 15)];
    self.modelLabel.backgroundColor = [UIColor orangeColor];
    self.modelLabel.layer.cornerRadius = 2;
    self.modelLabel.layer.masksToBounds = YES;
    self.modelLabel.textAlignment = NSTextAlignmentCenter;
    self.modelLabel.font = [UIFont systemFontOfSize:12];
    self.modelLabel.textColor = [UIColor whiteColor];
    self.modelLabel.text = self.car_model;
    [carDetails addSubview:self.modelLabel];
    
    //自动或手动
    self.speed_boxLabel = [[UILabel alloc] initWithFrame:CGRectMake(205, 45, 40, 15)];
    self.speed_boxLabel.backgroundColor = [UIColor grayColor];
    self.speed_boxLabel.layer.cornerRadius = 2;
    self.speed_boxLabel.layer.masksToBounds = YES;
    self.speed_boxLabel.textAlignment = NSTextAlignmentCenter;
    self.speed_boxLabel.font = [UIFont systemFontOfSize:12];
    self.speed_boxLabel.textColor = [UIColor whiteColor];
    self.speed_boxLabel.text = self.car_speed_box;
    [carDetails addSubview:self.speed_boxLabel];
    
    
    //分割线
    UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 35, kScreenWidth - 20, 0.5)];
    lineLabel.backgroundColor = lineColor;
    [carDetails addSubview:lineLabel];
    
    
}

#pragma mark 订单信息
- (void) orderDetailsView{
    
    //第三部分 订单信息
    UIView *orderDetails = [[UIView alloc] initWithFrame:CGRectMake(5, 165, kScreenWidth - 10, 130)];
    orderDetails.layer.cornerRadius = 2;
    orderDetails.layer.shadowOpacity = 1.0;
    orderDetails.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    orderDetails.layer.shadowColor = [UIColor colorWithRed:215 / 255.0 green:215 / 255.0 blue:215 / 255.0 alpha:1].CGColor;
    orderDetails.layer.shadowRadius = 1;
    orderDetails.backgroundColor = [UIColor whiteColor];
    [self.backgroundScrollView addSubview:orderDetails];
    
    UIImageView *orderImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
    orderImageView.image = [UIImage imageNamed:@"icon-indent-blue"];
    [orderDetails addSubview:orderImageView];
    
    UILabel *orderInformation = [[UILabel alloc] initWithFrame:CGRectMake(40, 10, 80, 20)];
    orderInformation.text = @"订单信息";
    orderInformation.textAlignment = NSTextAlignmentLeft;
    orderInformation.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    orderInformation.font = [UIFont systemFontOfSize:14];
    [orderDetails addSubview:orderInformation];
    
    //状态
    UILabel *stateInformationLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth - 60, 10, 45, 20)];
    stateInformationLabel.text = @"待支付";
    stateInformationLabel.textColor = mainColor;
    stateInformationLabel.textAlignment = NSTextAlignmentRight;
    stateInformationLabel.font = [UIFont systemFontOfSize:15];
    [orderDetails addSubview:stateInformationLabel];
    
    //状态信息
    
    //用车时间标签
    UILabel *useCarTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 55, 70, 14)];
    useCarTimeLabel.text = @"用车时间:";
    useCarTimeLabel.textAlignment = NSTextAlignmentCenter;
    useCarTimeLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    useCarTimeLabel.font = [UIFont systemFontOfSize:14];
    [orderDetails addSubview:useCarTimeLabel];
    
    //字符串转换成时间戳
    NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:[self.open_time intValue]];
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
    [dateFormat setDateFormat:@"yyyy/MM/dd HH:mm"];
    self.open_time = [dateFormat stringFromDate:confromTimesp];
    
    NSDate *confromTimespEnd = [NSDate dateWithTimeIntervalSince1970:[self.end_time intValue]];
    NSDateFormatter *dateFormatEnd = [[NSDateFormatter alloc]init];
    [dateFormatEnd setDateFormat:@"yyyy/MM/dd HH:mm"];
    self.end_time = [dateFormatEnd stringFromDate:confromTimespEnd];
    

    //用车时间显示
    UILabel *useCarTimeShowLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 41, kScreenWidth / 3 * 2, 39)];
    useCarTimeShowLabel.text = [NSString stringWithFormat:@"%@ (%@ - %@)", self.use_time, self.open_time , self.end_time];
    useCarTimeShowLabel.font = [UIFont systemFontOfSize:15];
    useCarTimeShowLabel.textAlignment = NSTextAlignmentLeft;
    useCarTimeShowLabel.textColor = wordColor;
    useCarTimeShowLabel.numberOfLines = 0;
    useCarTimeShowLabel.lineBreakMode = NSLineBreakByWordWrapping;
    [orderDetails addSubview:useCarTimeShowLabel];
    
    //交车地点标签
    UILabel *exchangeAdressLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 90, 70, 14)];
    exchangeAdressLabel.text = @"交车地点:";
    exchangeAdressLabel.textAlignment = NSTextAlignmentCenter;
    exchangeAdressLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    exchangeAdressLabel.font = [UIFont systemFontOfSize:14];
    [orderDetails addSubview:exchangeAdressLabel];
    
    //交车地点显示
    UILabel *exchangeAdressShowLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 81, kScreenWidth / 3 * 2, 39)];
    exchangeAdressShowLabel.text = self.car_address;
    exchangeAdressShowLabel.textAlignment = NSTextAlignmentLeft;
    exchangeAdressShowLabel.textColor = wordColor;
    exchangeAdressShowLabel.numberOfLines = 0;
    exchangeAdressShowLabel.lineBreakMode = NSLineBreakByWordWrapping;
    exchangeAdressShowLabel.font = [UIFont systemFontOfSize:15];
    [orderDetails addSubview:exchangeAdressShowLabel];
    
    //分割线
    UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 40, kScreenWidth - 20, 0.5)];
    lineLabel.backgroundColor = lineColor;
    [orderDetails addSubview:lineLabel];
    
}

#pragma mark 支付方式 第四部分
- (void) payMethod {
    
    //第一部分 支付方式
    UIView *payView = [[UIView alloc] initWithFrame:CGRectMake(5, 315, kScreenWidth - 10, 140)];
    payView.layer.cornerRadius = 2;
    payView.layer.shadowOpacity = 1.0;
    payView.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    payView.layer.shadowColor = [UIColor colorWithRed:215 / 255.0 green:215 / 255.0 blue:215 / 255.0 alpha:1].CGColor;
    payView.layer.shadowRadius = 1;
    payView.backgroundColor = [UIColor whiteColor];
    [self.backgroundScrollView addSubview:payView];
    
    UIImageView *payImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 25.28, 20)];
    payImageView.image = [UIImage imageNamed:@"icon-pay-way"];
    [payView addSubview:payImageView];
    
    UILabel *payWay = [[UILabel alloc] initWithFrame:CGRectMake(45, 10, 100, 20)];
    payWay.text = @"支付方式";
    payWay.textAlignment = NSTextAlignmentLeft;
    payWay.textColor = [UIColor blackColor];
    payWay.font = [UIFont systemFontOfSize:14];
    [payView addSubview:payWay];
    
    //分割线-----------------------------------------------------------------------
    UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 40, kScreenWidth - 20, 0.5)];
    lineLabel.backgroundColor = lineColor;
    [payView addSubview:lineLabel];
    
    //钱包图片
    UIImageView *moneyBagIV = [[UIImageView alloc] initWithFrame:CGRectMake(20, 50, 30, 30)];
    moneyBagIV.image = [UIImage imageNamed:@"icon-account"];
    [payView addSubview:moneyBagIV];
    
    UILabel *balanceOfAccount = [[UILabel alloc] initWithFrame:CGRectMake(70, 55, 65, 16)];
    balanceOfAccount.text = @"账户余额";
    balanceOfAccount.textAlignment = NSTextAlignmentLeft;
    balanceOfAccount.textColor = [UIColor blackColor];
    balanceOfAccount.font = [UIFont systemFontOfSize:14];
    [payView addSubview:balanceOfAccount];
    
    UILabel *useAccountLabel = [[UILabel alloc] initWithFrame:CGRectMake(150, 56, 150, 14)];
    useAccountLabel.text = [NSString stringWithFormat:@"可用余额: %@ 元", self.surplus_money];
    useAccountLabel.textAlignment = NSTextAlignmentLeft;
    useAccountLabel.font = [UIFont systemFontOfSize:14];
    useAccountLabel.textColor = mainColor;
    [payView addSubview:useAccountLabel];
    
    //选择小图标
    self.choiceImageV = [[UIImageView alloc] init];
    self.choiceImageV.image = [UIImage imageNamed:@"icon-pith-blue"];
    [payView addSubview:self.choiceImageV];
    
    //账户余额支付按钮
    UIButton *accountPayBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    accountPayBtn.frame = CGRectMake(0, 40, kScreenWidth - 10, 50);
    [accountPayBtn addTarget:self action:@selector(accountPayBtnTouchEvent) forControlEvents:UIControlEventTouchUpInside];
    [payView addSubview:accountPayBtn];
    
//    if ([self.is_surplus_rent isEqualToString:@"0"]) {
//        
//        accountPayBtn.userInteractionEnabled = NO;
//        
//    } else if ([self.is_surplus_rent isEqualToString:@"1"]) {
//        
//        accountPayBtn.userInteractionEnabled = YES;
//        
//    }

    //分割线----------------------------------------------------------------
    UILabel *lineLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(20, 90, kScreenWidth - 35, 0.5)];
    lineLabel2.backgroundColor = lineColor;
    [payView addSubview:lineLabel2];
    
    //银行卡图片
    UIImageView *bankCardIV = [[UIImageView alloc] initWithFrame:CGRectMake(20, 105, 30, 20)];
    bankCardIV.image = [UIImage imageNamed:@"icon-upay"];
    [payView addSubview:bankCardIV];
    
    UILabel *bankPayLabel = [[UILabel alloc] initWithFrame:CGRectMake(70, 105, 90, 20)];
    bankPayLabel.textAlignment = NSTextAlignmentLeft;
    bankPayLabel.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:51 / 255.0];
    bankPayLabel.textColor = [UIColor blackColor]  ;
    bankPayLabel.text = @"快捷支付";
    bankPayLabel.font = [UIFont systemFontOfSize:14];
    [payView addSubview:bankPayLabel];
    
    //快捷支付按钮
    UIButton *quickPayBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    quickPayBtn.frame = CGRectMake(0, 90, kScreenWidth - 10, 50);
    [quickPayBtn addTarget:self action:@selector(quickPayBtnTouchEvent) forControlEvents:UIControlEventTouchUpInside];
    [payView addSubview:quickPayBtn];
    

}

//返回上一级
- (void) BackAtTheNextHigherLevel {
    
    [self.navigationController popViewControllerAnimated:nil];
    
}

//车辆详情跳转
- (void) carDetailBtnPush {
    
    CarDetailForgeViewController *carDetailForgeVC = [[CarDetailForgeViewController alloc] init];
    carDetailForgeVC.carIDStr = self.car_id;
    
    [self.navigationController pushViewController:carDetailForgeVC animated:nil];
    
}

#pragma mark 确认支付
- (void) confirmationOrderPush {
    
    if ([self.is_pledge isEqualToString:@"0"]){
        //初始化提示框；
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"不能支付押金" preferredStyle:  UIAlertControllerStyleAlert];
        
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件；
        }]];
        
        //弹出提示框；
        [self presentViewController:alert animated:true completion:nil];

        
    } else if([self.is_pledge isEqualToString:@"1"]) {
        
        if (self.payMethodJudge == 0) {
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"请选择支付方式" preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        } else if (self.payMethodJudge == 1) {
            
            
            BalancePayDepositViewController *balance = [[BalancePayDepositViewController alloc]init];
            balance.order_sn = self.order_sn;
            
            [self.navigationController pushViewController:balance animated:nil];
            
            
        } else if (self.payMethodJudge == 2) {
            
            BankCardPayDepositViewController *balance =[[BankCardPayDepositViewController alloc]init];
            
            balance.order_sn = self.order_sn;
            
            [self.navigationController pushViewController:balance animated:nil];
            
        }

    }
    
}

#pragma mark 账户余额支付
- (void) accountPayBtnTouchEvent {

    self.payMethodJudge = 1;

    self.choiceImageV.frame = CGRectMake(kScreenWidth - 40, 55, 20, 20);
    
}

#pragma mark 快捷支付
- (void) quickPayBtnTouchEvent {
    
    if ([self.is_shortcut_pay isEqualToString:@"0"]) {
        
        //初始化提示框；
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"不能进行快捷支付" preferredStyle:  UIAlertControllerStyleAlert];
        
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件；
        }]];
        
        //弹出提示框；
        [self presentViewController:alert animated:true completion:nil];
        
        
    } else if ([self.is_shortcut_pay isEqualToString:@"1"]){
        
        self.choiceImageV.frame = CGRectMake(kScreenWidth - 40, 105, 20, 20);
        
        self.payMethodJudge = 2;
        
    }
    
}
#pragma mark 返回值分析
- (void) resultAnalysis {
    
    int status = [self.status intValue];
    
    switch (status) {
        case 99:{
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 98:{
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 97:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 96:
        {
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 1:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 2:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 3:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
        case 4:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
        case 5:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
        case 6:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
        case 7:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
        case 8:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
        case 9:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
        case 10:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
        case 11:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
        case 12:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
        case 13:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
                //点击按钮的响应事件；
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
            
        }
            break;
            
        case 100:
        {
            
            
            
        }
            break;
            
        default:
            break;
    }
    
    
    
}


@end
